package com.xian.im.modules.avchat.callback;

import java.util.Map;
import java.util.ServiceLoader;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @program: xian-code
 * @description: 通知上下文
 * @author: liru.xian
 * @create: 2021-01-21 15:45
 **/
public class NotificationHandlerContext {

    private static Map<String,Notification> notificationMap = new ConcurrentHashMap<>();

    static {
        ServiceLoader<Notification> loader = ServiceLoader.load(Notification.class);
        for (Notification notification : loader) {
            notificationMap.put(notification.type(),notification);
        }
    }

    public static Notification getNotification(String  type){
        return notificationMap.get(type);
    }
}
